package com.ytjj.qmyx.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.ytjj.common.api.CommonPage;
import com.ytjj.qmyx.admin.dao.VersionDao;
import com.ytjj.qmyx.admin.model.request.VersionRequest;
import com.ytjj.qmyx.admin.service.VersionService;
import com.ytjj.qmyx.mall.mapper.VersionMapper;
import com.ytjj.qmyx.mall.model.Version;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class VersionServiceImpl implements VersionService {

    @Resource
    private VersionDao versionDao;

    @Resource
    private VersionMapper versionMapper;

    @Override
    public CommonPage<Version> selectList(VersionRequest versionRequest) {
        PageHelper.startPage(versionRequest.getPageNum(), versionRequest.getPageSize());
        List<Version> ordersList = versionDao.selectList(versionRequest);
        return CommonPage.restPage(ordersList);
    }

    @Override
    public int edit(Version version) {
        return versionMapper.updateByPrimaryKey(version);
    }

    @Override
    public int insert(Version version) {
        return versionMapper.insertSelective(version);
    }

}
